home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / The GIMP 2.2.8 / gimp-2.2.8-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / old-photo.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2005-06-30  |  3.4 KB  |  103 lines

  1. ;
  2. ; old-photo
  3. ;
  4. ;
  5. ; Chris Gutteridge (cjg@ecs.soton.ac.uk)
  6. ; At ECS Dept, University of Southampton, England.
  7.  
  8. ; This program is free software; you can redistribute it and/or modify
  9. ; it under the terms of the GNU General Public License as published by
  10. ; the Free Software Foundation; either version 2 of the License, or
  11. ; (at your option) any later version.
  12. ; This program is distributed in the hope that it will be useful,
  13. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. ; GNU General Public License for more details.
  16. ; You should have received a copy of the GNU General Public License
  17. ; along with this program; if not, write to the Free Software
  18. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. ;
  20. ; Branko Collin <collin@xs4all.nl> added the possibility to change
  21. ; the border size in October 2001.
  22.  
  23. ; Define the function:
  24.  
  25. (define (script-fu-old-photo inImage inLayer inDefocus inBorderSize inSepia inMottle inCopy)
  26.   (gimp-image-undo-group-start inImage)
  27.   (gimp-selection-all inImage)
  28.   (set! theImage (if (= inCopy TRUE)
  29.              (car (gimp-image-duplicate inImage))
  30.              inImage)
  31.         )
  32.   
  33.   (set! theLayer (car (gimp-image-flatten theImage)))
  34.   (if (= inDefocus TRUE)
  35.       (plug-in-gauss-rle TRUE theImage theLayer 1.5 TRUE TRUE)
  36.       ()
  37.       )
  38.   (if (> inBorderSize 0)
  39.       (script-fu-fuzzy-border theImage theLayer '(255 255 255)
  40.                   inBorderSize TRUE 8 FALSE 100 FALSE TRUE )
  41.       ()
  42.       )
  43.   (set! theLayer (car (gimp-image-flatten theImage)))
  44.   
  45.   (if (= inSepia TRUE)
  46.       (begin (gimp-desaturate theLayer)
  47.          (gimp-brightness-contrast theLayer -20 -40)
  48.          (gimp-color-balance theLayer 0 TRUE 30 0 -30)
  49.          )
  50.       ()
  51.       )
  52.   (set! theWidth (car (gimp-image-width theImage)))
  53.   (set! theHeight (car (gimp-image-height theImage)))
  54.   (if (= inMottle TRUE)
  55.       (begin (set! mLayer (car (gimp-layer-new theImage theWidth theHeight RGBA-IMAGE "Mottle" 100 DARKEN-ONLY-MODE)))
  56.          
  57.          (gimp-image-add-layer theImage mLayer 0)
  58.          (gimp-selection-all theImage)
  59.          (gimp-edit-clear mLayer)
  60.          (gimp-selection-none theImage)
  61.          (plug-in-noisify TRUE theImage mLayer TRUE 0 0 0 0.5)
  62.          (plug-in-gauss-rle TRUE theImage mLayer 5 TRUE TRUE)
  63.          (set! theLayer (car (gimp-image-flatten theImage)))
  64.          )
  65.       ()
  66.       )
  67.   
  68.   
  69.   
  70.   (if     (= inCopy TRUE)
  71.       (begin  (gimp-image-clean-all theImage)
  72.           (gimp-display-new theImage)
  73.           )
  74.       ()
  75.       )
  76.   (gimp-selection-none inImage)
  77.   (gimp-image-undo-group-end inImage)
  78.   (gimp-displays-flush theImage)
  79.   )
  80.  
  81. (script-fu-register "script-fu-old-photo"
  82.             _"_Old Photo..."
  83.             "Makes the image look like an old photo. A border size of 0 means no border."
  84.             "Chris Gutteridge"
  85.             "1998, Chris Gutteridge / ECS dept, University of Southampton, England."
  86.             "16th April 1998"
  87.             "RGB* GRAY*"
  88.             SF-IMAGE      "The image"     0
  89.             SF-DRAWABLE   "The layer"     0
  90.             SF-TOGGLE     _"Defocus"      TRUE
  91.             SF-ADJUSTMENT _"Border size"  '(20 0 300 1 10 0 1)
  92.             ; since this plug-in uses the fuzzy-border plug-in, I used the
  93.             ; values of the latter, with the exception of the initial value
  94.             ; and the 'minimum' value.
  95.             SF-TOGGLE     _"Sepia"        TRUE
  96.             SF-TOGGLE     _"Mottle"       FALSE
  97.             SF-TOGGLE     _"Work on copy" TRUE)
  98.  
  99. (script-fu-menu-register "script-fu-old-photo"
  100.              _"<Image>/Script-Fu/Decor")
  101.